package `fun`.codedesign.kotlin.mixin

import `fun`.codedesign.java.EventBusExecutor
import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.concurrent.write

class EventBus internal constructor(builder: Builder) {
    companion object {

        @JvmStatic
        fun hello(value: String)= println(value)
    }

    constructor() : this(Builder())

    class Builder() {
        fun build(): EventBus? = EventBus(this)
    }
}

fun main() {
    val hello = EventBusExecutor("zhangsan")
    println(hello.name)

    val lock = ReentrantReadWriteLock()
    lock.write {  }
    val bus = EventBus()
    bus.append("append")
}

inline fun EventBus.append(value: String?) = println(value)